/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ps.yj.y1j0.business;

import ps.yj.y1j0.util.YJFileTool;

import javax.naming.InitialContext;

/**
 * @author yanjun
 */
public class YJWriteToFile {
    private static YJWriteToFile yjWriteToFile = null;
    private static String configPath = null;

    private YJWriteToFile() throws Exception {
        InitialContext ic = new InitialContext();
        configPath = (String) ic.lookup("java:comp/env/configPath");
        if (configPath == null)
            throw new RuntimeException("不能找到configPath!");
    }

    public static YJWriteToFile getInstance() throws Exception {
        if (yjWriteToFile == null)
            yjWriteToFile = new YJWriteToFile();
        return yjWriteToFile;
    }

    public Boolean write(String name, String content) {
        return YJFileTool.write(configPath, name, content);
    }
}
